<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2019/10/22
 * Time: 13:50
 */

namespace app\adminapiv3\service;

//密码服务
class Password
{

    /**
     * @name 用户密码加密
     * @param $password
     * @param $salt
     * @return bool|string
     * @Author wx
     * @date 2019/5/17 10:02
     */
    public function encrypt($password, $salt)
    {
        return password_hash($password.$salt,PASSWORD_DEFAULT);
    }


    /**
     * @name 验证用户密码
     * @param $password
     * @param $salt
     * @param $password_hash
     * @return bool
     * @Author wx
     * @date 2019/5/17 10:06
     */
    public function decrypt($password, $salt, $password_hash)
    {
        return password_verify($password.$salt, $password_hash);
    }
}